]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
layout: Debounce triggering barriers
authorJasper St. Pierre <jstpierre@mecheye.net>
Fri, 1 Mar 2013 20:29:42 +0000 (15:29 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 4 Mar 2013 20:50:44 +0000 (15:50 -0500)
Ensure that the pointer leaves the barrier before we trigger again.

For the message tray case, this doesn't matter much, as the trigger
won't have any effect after the grab is taken, but in the overview
HotCorner case, this ensures that we don't trigger the overview
transition many times simply by holding pressure against the hot
corner, which is easy to do accidentally.

js/ui/layout.js

index bcc0dda6e45aea5b07c93f0d44ec6f7cab5ee1e1..e2691c0f42bea8b9bb7e3fc4a1c297c1a19119cb 100644 (file)
@@ -1264,6 +1264,7 @@ const PressureBarrier = new Lang.Class({
         this._timeout = timeout;
         this._orientation = (barrier.y1 == barrier.y2) ? Clutter.Orientation.HORIZONTAL : Clutter.Orientation.VERTICAL;
 
+        this._isTriggered = false;
         this._reset();
 
         this._barrierHitId = this._barrier.connect('hit', Lang.bind(this, this._onBarrierHit));
@@ -1322,14 +1323,21 @@ const PressureBarrier = new Lang.Class({
 
     _onBarrierLeft: function(barrier, event) {
         this._reset();
+        this._isTriggered = false;
     },
 
     _trigger: function() {
+        this._isTriggered = true;
         this.emit('trigger');
         this._reset();
     },
 
     _onBarrierHit: function(barrier, event) {
+        // If we've triggered the barrier, wait until the pointer has the
+        // left the barrier hitbox until we trigger it again.
+        if (this._isTriggered)
+            return;
+
         // Throw out all events where the pointer was grabbed by another
         // client, as the client that grabbed the pointer expects to have
         // complete control over it